Contour enhancment unit and method to enhance the contours of an image

ABSTRACT

An image enhancement unit and method for enhancing the image quality of a video stream is presented. The image enhancement unit combines a contour enhancement unit, a luminance contrast stretching unit, a color transient improvement unit, and a color saturation control unit to enhance both the luminance and chrominance values in the video stream. Specifically, the contour enhancement unit processes the luminance values to improve the contours of the images in the video steam. The luminance contrast stretching unit further improves the luminance by enhancing the contrast in the images. The color transient improvement unit processes the chrominance values to remove blurring around along the edges of color transitions and the color saturation control unit increases the color saturation to improve the appearance of the images.

RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.10/839,744 entitled “Image Enhancement Unit and Method for Image QualityImprovement of a Video Stream” filed by Ge Zhu on May 4, 2004.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to digital image and video processing.More specifically, the present invention relates to methods of enhancingpicture quality of video streams.

2. Discussion of Related Art

Due to advancing semiconductor processing technology, integratedcircuits (ICs) have greatly increased in functionality and complexity.With increasing processing and memory capabilities, many formerly analogtasks are being performed digitally. For example, images, audio and evenfull motion video can now be produced, distributed, and used in digitalformats.

FIG. 1 is an illustrative diagram of a portion of interlaced digitalvideo stream 100 most often used in television systems. Interlaceddigital video stream 100 comprises a series of individual fields 100_1to 100_N, of which the first ten fields are shown. Even fields containeven numbered rows while odd fields contain odd numbered rows. Forexample if a frame has 400 rows of 640 pixels, the even field wouldcontains rows 2, 4, . . . 400 and the odd field would contains rows 1,3, 5, . . . 399 of the frame. In general for an interlaced video streameach field is formed at a different time. For example, an interlacedvideo capture device (e.g. a video camera) captures and stores the oddscan lines of a scene at time T as field 100_1, then the video capturedevice stores the even scan lines of a scene at time T+1 as field 100_2.The process continues for each field.

Interlaced video systems were designed when bandwidth limitationsprecluded progressive (i.e., non-interlaced) video systems with adequateframe rates. Specifically, interlacing two 30 fps fields achieved aneffective 60 frame per second frame rate because the phosphors used intelevision sets would remain “lit” while the second field is drawn.Progressive video streams use complete frames, including both the evenand odd scan lines instead of fields. Because progressive scan providesbetter display quality, computer systems, which were developed muchlater than the original television systems, use progressive scan displaysystems. Furthermore, many modern televisions and television equipmentare being developed to use progressive video streams. To maintaincompatibility with existing interlaced video systems, modern progressivesystems use deinterlacing techniques to convert interlaced video streamsinto progressive video streams.

FIGS. 2( a) and 2(b) illustrate a typical method of generating aprogressive video stream 200 from an interlaced video stream 100.Specifically each field 100_X of interlaced video stream 100 isconverted to a frame 200_X of progressive video stream 200. Theconversion of a field to a frame is accomplished by generating themissing scan lines in each frame by copying or interpolating from thescan lines in the field. For example, as illustrated in FIG. 2( b) field100_1 having odd scan lines 100_1_1, 100_1_3, 100_1_5, . . . 100_1_N, isconverted into a frame 200_1 by copying scan lines 100_1_X as odd scanlines 200_1_X, where X is an odd number and creating even scan lines200_1_Y, where Y is an even number. Even scan lines 200_1_Y can becreated by copying the preceding odd scan line 200_1_Y−1. This techniqueis commonly known as line repeat. Better results can be obtained usingvarious interpolation schemes to generate the missing scan lines. Forexample, one interpolation scheme simply averages odd scan line200_1_Y−1 with odd scan line 200_1_Y+1 to generate even scan line200_1_Y. Other interpolation schemes may use weighted averages or othermore complicated ways to combine data from the existing scan lines togenerate the missing scan lines. Another normal mode deinterlacingtechnique known as 3D deinterlacing involves generating the missing scanlines by interpolating the missing pixels using data from adjacentfields. Conversion of fields into frames is not an integral part of thepresent invention. The principles of the present invention can easily beadapted for use with any form of field to frame conversion.

While de-interlacing techniques allow interlaced video streams to bedisplayed on progressive scan devices, the image quality of thede-interlaced video stream is typically of much lower image quality thantrue progressive scan video streams (i.e. video streams that weregenerated using progressive scan equipment). Hence, there is a need fora method or system that can enhance the image quality of the frames in ade-interlaced video stream

SUMMARY

Accordingly, the present invention provides methods and systems forenhancing the image quality of a video stream. While the methods andsystems of the present invention are especially well-suited forde-interlaced video streams, the methods and systems of the presentinvention also provide enhancement to the image quality of trueprogressive video streams as well. Specifically, the present inventionenhances the chrominance and luminance of a de-interlaced video frameindependently. Thus, in most embodiments of the present invention theluminance enhancement and chrominance enhancements are performed inparallel to reduce processing time.

In some embodiment of the present invention, an image enhancement unitcombines a contour enhancement unit and a luminance contrast stretchingunit to enhance the luminance values of the input video stream. Theimage enhancement unit also includes a color transient improvement unitand a color saturation control unit to enhance the chrominance values ofthe input video stream. Specifically, the contour enhancement unitenhances the contours of the images in the input video stream to improvethe depth-of-field of the images around lines and edges. The luminancecontrast stretching unit stretches the luminance values to enhancecontrast of the images. The color transient improvement unit improvescolor transients to remove blurring along the edges of colortransitions. The color saturation control unit adjusts the colorsaturation to compensate for washed out colors that may result fromanalog to digital conversions.

In one embodiment of the contour enhancement unit, a contour detectionunit is configured to determine a dominant contour direction for acurrent pixel. A contour enhanced luminance calculation unit enhancesthe contour by a contour enhancement factor along the dominant contourdirection. The contour direction is approximated using slopes.Specifically, the slopes in a variety of slope directions are calculatedand the slope direction with the greatest absolute slope value isselected as the direction of the contour. A contour threshold comparisonunit compares the difference between the greatest absolute slope valueand the second greatest absolute slope value with a contour enhancementthreshold. When the difference is greater than the contour enhancementthreshold, contour enhancement is performed.

In an embodiment of the color transient improvement unit, a transientcharacterization unit is configured to calculate transientcharacterization values for a color transient detection window thatcontains a current pixel. A transient threshold unit determines whethera color transient exists in the color transient detection window bycomparing the transient characterization values to a chrominance colorimprovement threshold. When a color transient is detected, a transientcorrection unit generates an improved U chrominance value and animproved V chrominance value for the current pixel.

In an embodiment of the color saturation control unit, a scaledsaturation enhancement factor calculation unit is configured to generatea scaled saturation enhancement factor using a base saturationenhancement factor. A multiplier is coupled to receive the scaledsaturation enhancement factor and configured to generate a saturationenhanced U chrominance value and a saturation enhanced V chrominance forthe current pixel. Specifically, the saturation enhanced U chrominancevalue is equal to the scaled saturation enhancement factor multiplied bythe current U chrominance value of the current pixel. Similarly, thesaturation enhanced V chrominance value is equal to the scaledsaturation enhancement factor multiplied by the current V chrominancevalue of the current pixel. To maintain the proper color the ratio ofthe saturation enhanced U chrominance value to the saturation enhanced Vchrominance value should be equal to the ratio of the current Uchrominance value to the current V chrominance value. An indexcalculation and control circuit receives the base saturation enhancementfactor, the current U chrominance value, and the current V chrominancevalue and generates an index to a lookup table. The lookup tablecontains tabled saturation enhancement factors that can be used as thescaled saturation enhancement factor when the base saturationenhancement factor would cause the saturation enhanced U chrominancevalue or the saturation enhanced V chrominance value to exceed a validrange of chrominance values.

The present invention will be more fully understood in view of thefollowing description and drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an illustration of an interlaced video stream.

FIGS. 2( a) and 2(b) illustrate a deinterlacing process to form ade-interlaced video stream.

FIG. 3 is a simplified block diagram of an image enhancement unit inaccordance with one embodiment of the present invention.

FIG. 4 is a simplified block diagram of contour enhancement unit inaccordance with one embodiment of the present invention.

FIG. 5 illustrates the function of a luminance contrast stretching unitin accordance with one embodiment of the present invention.

FIG. 6 illustrates the color transient problem.

FIG. 7 is a simplified block diagram for a digital Color TransientImprovement unit in accordance with one embodiment of the presentinvention.

FIG. 8 is a simplified block diagram for a color saturation control unitin accordance with one embodiment of the present invention.

FIG. 9 is a block diagram of a SSEF calculation unit in accordance withone embodiment of the present invention.

DETAILED DESCRIPTION

As explained above, interlaced video streams that are de-interlaced intoprogressive video streams are typically of lower image quality than trueprogressive video streams. The present invention presents four novelimage enhancement techniques that can be used singly or in combinationto enhance the image quality of a frame of a video stream.

FIG. 3 is a simplified block diagram of an image enhancement unit 320coupled to a buffer 310. Buffer 310 includes a first line buffer 310_0,a second line buffer 310_1, and a third line buffer 310_2. The size ofthe line buffers is typically equal to the line size of a frame in aninput video stream I_VS. Buffer 310 is used as a circular buffer so thatthe first line of a frame of input video stream I_VS is written intoline buffer 310_0, the second line of the frame is written into linebuffer 310_1, the third line of frame is written into line buffer 310_2.Then the fourth line of the frame is written into line buffer 310_0, thefifth line of frame is written into line buffer 310_1, and the sixthline of the frame is written into line buffer 310_2. This processcontinues for all the lines of each frame of input video stream I_VS.

Thus, in general buffer 310 contains three lines of a frame from inputvideo stream I_VS. In one embodiment of the present invention, imageenhancement unit 320 uses a current line pointer CLP to track which linebuffer contains the current line that is being processed, a previousline pointer PLP to track which line buffer contains the line before thecurrent line, and a next line pointer NLP to track which line buffercontains the line following the current line. Thus, initially, previousline pointer PLP would point to line buffer 310_0, current line pointerCLP would point to line buffer 310_1, and next line pointer NLP wouldpoint to line buffer 310_2. However, as new lines are written intobuffer 310 from a frame of input video stream I_VS, previous linepointer PLP, current line pointer CLP, and next line pointer NLP wouldbe incremented by 1 using modulo 3 addition (i.e. incremented by 1 butalso reset to 0 if the pointer is equal to 3 after being incremented).Specifically, if previous line pointer PLP is pointing to line buffer310_X, after a new line is read into buffer 310, previous line pointerPLP would point to line buffer 310_((X+1) MOD 3). For convenience, theline in the buffer pointed to by previous line pointer PLP is called the“previous line.” Similarly, the line in the buffer pointed to by currentline pointer CLP is called the “current line” and the line in the bufferpointed to by next line pointer NLP is called the “next line.” Otherembodiments of the present invention may include a larger buffer tostore more lines simultaneously.

Image enhancement unit 320 includes a contour enhancement unit 322, aluminance contrast stretching unit 324, a color transient improvementunit 326, and a color saturation control unit 328. Contour enhancementunit 322 and luminance contrast stretching unit 324, which process theluminance values of a frame, can function in parallel with colortransient improvement unit 326 and color saturation control unit 328,which process the chrominance value of the frames.

Contour enhancement unit 322 performs contour enhancement to improve thedepth-of-field of an image around lines and edges. Specifically, contourenhancement unit 322 enhances local contour based on a user programmablecontour enhancement factor CEF. A novel contour enhancement unit isdescribed below. Luminance contrast stretching unit 324 stretches theluminance values to enhance contrast. A novel luminance contraststretching unit is described below.

Color transient improvement unit 326 improves color transients to removeblurring along the edge between two color areas. A novel digital colortransient improvement unit is described below. Color saturation controlunit 328 increases the color saturation to compensate for washed outcolors caused by analog to digital conversion. A novel color saturationcontrol unit is described below.

Generally, image enhancement unit 320 processes one pixel at a time frombuffer 310. For convenience and clarity, the pixel currently beingprocessed is referred to herein as the current pixel. As explainedabove, contour enhancement unit 322 and luminance contrast stretchingunit 324 would process the luminance value Y of the current pixel.Specifically, contour enhancement unit 322 generates a contour enhancedluminance value Y_CE and luminance contrast stretching unit 324generates a contrast stretched luminance value Y_CS from contourenhanced luminance value Y_CE. Color transient improvement unit 326 andcolor saturation control unit 328 would process the chrominance values Uand V of the current pixel. Specifically, color transient improvementunit 326 generates improved U chrominance value IUC and improvedchrominance value IVC and color saturation control unit 328 generatessaturation enhanced U chrominance value SEUC and saturation enhanced Vchrominance value SEVC from improved U chrominance value IUC andimproved V chrominance value IVC.

FIG. 4 is a simplified block diagram of a contour enhancement unit 400in accordance with one embodiment of the present invention. Contourenhancement unit 400 includes a contour detection unit 410, a contourthreshold comparison unit 420, and a contour-enhanced luminancecalculation unit 430. In FIG. 4, contour enhancement unit 400 is coupledto buffer 310, which is illustrated using previous line pointer PLP,current line pointer CLP and next line pointer NLP. Contour enhancementunit 400 is configured to generate contour enhanced luminance value Y_CEfor current pixel P4 using the luminance value of current pixel P4 andthe luminance values of pixels P0, P1, P2, P3, P5, P6, P7, and P8, whichsurround current pixel P4. Specifically, current pixel P4, pixel P3 andpixel P5 are in the current line (i.e. in the line buffer pointed to bycurrent line buffer CLP), with pixel P3 to the left of current pixel P4and pixel P5 to the right of current pixel P4. Pixels P0, P1, and P2 arein the previous line (i.e. in the line buffer pointed to by previousline buffer PLP) directly above pixels P3, P4, and P5, respectively.Conversely, pixels P6, P7, and P8 are in the next line (i.e. in the linebuffer pointed to by the next line buffer NLP), directly below pixelsP3, P4, and P5, respectively. For clarity the luminance value of a pixelPX is referenced as luminance value YX. Thus, the luminance value ofpixel P5 is luminance value Y5.

Contour detection unit 410 detects the contour around current pixel P4.In the embodiment of FIG. 4, slope around current pixel P4 is used as aproxy for the magnitude of the contour directions around current pixelP4. Specifically in the embodiment of FIG. 4, contour detection unit 410calculates the slopes around current pixel P4 and selects the directionwith the largest absolute slope value as the dominant contour directionof the contour around pixel P4. The largest absolute slope value is alsoused to represent the magnitude of the dominant contour direction. Inone embodiment of contour detection unit 410, three slopes for threedirections are calculated: horizontal slope S_H, vertical slope S_V, anddiagonal slope S_D.

Horizontal slope S_H represents the amount of luminance change due tohorizontal contour passing through current pixel P4. Equation EQ (1)gives the formula used by one embodiment of the present invention tocalculate horizontal slope S_H. In equation EQ (1), horizontal slope S_His equal to the average of the luminance values of pixels P3, P4, and P5minus the average of the luminance values of pixels P0, P1, P2, P6, P7and P8.

S _(—) H=(Y3+Y4+Y5)/3−(Y0+Y1+Y2+Y6+Y7+Y8)/6  EQ (1)

Conversely, vertical slope S_V represents the amount of luminance changedue to the vertical contour passing through current pixel P4. EquationEQ (2) gives the formula used by one embodiment of the present inventionto calculate vertical slope S_V. In equation EQ (2), vertical slope S_Vis equal to the average of the luminance values of pixels P1, P4 and P7minus the average of the luminance values of pixels P0, P3, P6, P2, P5and P8.

S _(—) V=(Y1+Y4+Y7)/3−(Y0+Y3+Y6+Y2+Y5+Y8)/6  EQ (2)

Diagonal slope S_D represents the amount of luminance change aroundcurrent pixel P4 in a diagonal direction (both 45 degrees and 135degrees). Equation EQ (3) gives the formula used by one embodiment ofthe present invention to calculate diagonal slope S_D. In equation EQ(3), diagonal slope S_D is equal to the luminance value of pixel P4minus the average of the luminance values of pixels P1, P3, P5 and P7.

S _(—) D=Y4−(Y1+Y3+Y5+Y7)/4  EQ (3)

A positive value for horizontal slope S_H, vertical S_V, or diagonalslope S_D indicates that current pixel P4 is on the brighter side of anedge (assuming higher luminance value represents brighter pixels).Conversely, a negative value for horizontal slope S_H, vertical S_V, ordiagonal slope S_D indicates that current pixel P4 is on the darker sideof an edge.

Other embodiments of the present invention can calculate slopesdifferently. For example in a specific embodiment of the presentinvention, rather than a single diagonal slope S_D, a 45 degree slopeS_45 and a 135 degree slope S_135 are used. Furthermore, someembodiments of the present invention may use additional slopedirections. For example, the slope value of a slope direction between 45degree and 90 degree can be calculated as the average of the luminancevalues of pixels P2, P4 and P7 minus the average of the luminance valuesof pixels P1, P3, P6, P5 and P8.

In general contour enhancement should be performed in the dominantcontour direction. However if the magnitude of the dominant contourdirection is not significantly greater than the magnitude of thesecondary contour direction contour enhancement should not be performed.Specifically, when the magnitude of the dominant contour direction minusthe magnitude of the secondary contour direction is greater than acontour enhancement threshold then contour enhancement should beperformed. However, when the magnitude of the dominant contour directionminus the magnitude of the secondary contour direction is less than orequal to the contour enhancement threshold then contour enhancementshould not be performed.

When slope direction as a proxy for contour direction, contourenhancement should be performed in the dominant slope direction. Thedominant slope direction has the largest absolute slope value. Forclarity the slope value in the dominant slope direction is referred toas the dominant slope value. For clarity, a maximum slope S_MAX isdefined to be equal to the largest absolute value of the directionalslopes (e.g. horizontal slope S_H, vertical slope S_V, and diagonalslope S_D). Thus, the absolute value of the dominant slope value wouldbe equal to maximum slope S_MAX. However if maximum slope S_MAX, whichis a proxy for the magnitude of the dominant contour direction is notsignificantly greater than the next largest absolute slope value, whichis a proxy for the magnitude of the secondary contour direction, contourenhancement should not be performed. Thus, contour threshold comparisonunit 420 calculates both maximum slope S_MAX and a next maximum slopeS_NEXT, where next maximum slope S_NEXT is equal to the second largestabsolute value among the directional slopes. If maximum slope S_MAXminus next maximum slope S_NEXT is less than or equal to a contourenhancement threshold CE_T then contour enhancement is not performed andcontour-enhanced luminance calculation unit 430 is configured to setcontour enhanced luminance value Y_CE to be equal to luminance value Y4(i.e., the original luminance value of current pixel P4). However, ifmaximum slope S_MAX minus next maximum slope S_NEXT is greater thancontour enhancement threshold CE_T then contour enhancement contourenhanced luminance calculation unit 430 is configured to generate acontour enhanced luminance value Y_CE using contour enhancement factorCEF. In theory contour enhancement threshold CE_T can be any valuewithin the range of luminance values. However, setting contourenhancement threshold CE_T to a large value would only enhance edgesthat are already “stand out” in the frame. Thus, contour enhancementthreshold should be small in comparison to the maximum luminance valueso that blurry edges will be enhanced. For example in one embodiment ofthe present invention the luminance rage is 0 to 255 (i.e. 8-bit pixels)and the contour enhancement threshold has a default value of 5 with arecommended range of 0 to 10.

If contour enhancement should occur, contour-enhanced luminancecalculation unit generates contour enhanced luminance value Y_CE so thata contour enhanced slope S_CE calculated with contour enhanced luminancevalue Y_CE in place of luminance value Y4 would equal the contourenhanced factor CEF multiplied by the dominant slope value calculatedusing luminance value Y4. Thus for example if horizontal slope S_H werethe dominant slope value (i.e., maximum slope S_MAX is equal to theabsolute value of horizontal slope S_H), then contour enhanced slopeS_CE should be equal to contour enhanced factor CEF multiplied byhorizontal slope S_H. Equation EQ (4) illustrates the calculation ofcontour enhanced slope S_CE if horizontal slope S_H is the dominantslope value. Specifically, Equation EQ (4) is the same as Equation EQ(1) except that luminance value Y4 is replaced with contour enhancedluminance value Y_CE.

S _(—) CE=(Y3+Y _(—) CE+Y5)/3−(Y0+Y1+Y2+Y6+Y7+Y8)/6  EQ (4)

Replacing contour enhanced slope S_CE with contour enhanced factor CEFmultiplied by horizontal slope S_H yields Equation EQ (5).

CEF*S _(—) H=(Y3+Y _(—) CE+Y5)/3−(Y0+Y1+Y2+Y6+Y7+Y8)/6  EQ (5)

Equation EQ (5) can be rearranged to generate equation EQ (6), whichprovides a formula for contrast enhanced luminance value Y_CE whenhorizontal slope S_H is the dominant slope value.

Y _(—) CE=3*S _(—) H*CEF+(Y0+Y1+Y2+Y6+Y7+Y8)/2−Y3−Y5  EQ (6)

Similarly, equations EQ (7) and EQ (8) can be generated for calculatingcontour enhanced value Y_CE when the dominant slope value is verticalslope S_V and diagonal slope S_D, respectively.

Y _(—) CE=3*S _(—) V*CEF+(Y0+Y3+Y6+Y2+Y5+Y8)/2−Y1−Y7  EQ (7)

Y _(—) CE=S _(—) D*CEF+(Y1+Y3+Y5+Y7)/4  EQ (8)

However, as explained above if maximum slope S_MAX minus next maximumslope S_NEXT is less than or equal to contour enhancement thresholdCE_T, contour enhanced luminance calculation unit 430 is configured toset contour enhanced luminance value Y_CE to be equal to luminance valueY4 regardless of which slope is the dominant slope direction. Contourenhancement factor CEF should be a positive real number greater than orequal to 1 (a contour enhancement factor equal to 1 would provide noenhancement and would effectively deactivate contour enhancement). Ifcontour enhancement factor CEF is less than 1 then contours are actuallyblurred rather than enhanced. In general larger values for contourenhancement factor CEF produces sharper edges. In one embodiment of thepresent invention, contour enhancement factor CEF is stored in aprogrammable register and has a default value of 1.5 with a suggestedrange of 1.0 to 3.0.

As illustrated in FIG. 3, contour enhancement unit 322 provides contourenhanced luminance value Y_CE to luminance contrast stretching unit 324,which generates contrast stretched luminance value Y_CS. Luminancecontrast stretching unit 324 increases the contrast between pixelsexcept in very dark or very bright areas of the frame. In one embodimentof the present invention, luminance contrast stretching unit 324 mapseach contour enhance luminance value Y_CE to a contrast stretchedluminance value Y_CS using sigmoid-like function. FIG. 5 illustrates asigmoid function 510 with the contour enhanced luminance values on thehorizontal axis and the contrast stretched luminance values on thevertical axis. Specifically, FIG. 5 shows that a first contour enhancedluminance value Y_CE_1 and a second contour enhanced luminance valueY_CE_2 are mapped through sigmoid function 510 into a first contraststretched luminance value Y_CS_1 and a second contrast stretchedluminance value Y_CS_2, respectively. For most values of the contourenhanced luminance, the contrast between the first contrast stretchedluminance value Y_CS_1 and the second contrast stretched luminance valueY_CS_2 is greater than the contrast between the first contour enhancedluminance value Y_CE_1 and the second contour enhanced luminance valueY_CE_2. However, in very bright or very dark regions (i.e., for large orsmall values of contour enhanced luminance values), the contrast betweenthe contrast stretched luminance values is less than the contrastbetween the contour enhanced luminance values. Thus, luminance contraststretching unit 324 enhances contrast only in regions that are not verybright or not very dark. For example, where luminance ranges between 0and 255, very bright typically means luminance values greater than 240and very dark typically means luminance values less than 15. For a videosystem with relatively small luminance values range (e.g. 0 to 255),many embodiments of the present invention implements luminance contraststretching unit 324 as a predefined lookup table (LUT). Thecharacteristics of the sigmoid function can be changed by changing thevalues in the lookup table. For larger ranges of luminance values (e.g.0 to 1023 for 10-bit systems) various fitting formulas can be used topiece-wisely represent the sigmoid function without requiring a look uptable encompassing the whole range of luminance values. Contraststretched luminance value Y_CS is combined with saturation enhanced Uchrominance value SEUC and saturation enhanced V chrominance value SEVCto form a pixel in output video stream O_VS.

While contour enhancement unit 322 and luminance contrast stretchingunit 324 processes the luminance of a current pixel, color transientimprovement unit 326 and color saturation control unit 328 can processthe chrominance values of the current pixel. FIGS. 6( a)-6(e) illustratea color transient issue, which occurs frequently due to imperfectdecoding of video streams. FIG. 6( a) shows seven pixels 611-617. Pixels611-613 are part of a first color region and pixels 614-617 are part ofa second color region. Ideally the transition between the first colorregion and the second color region would be very distinct. For example,FIG. 6( b) illustrates the U chrominance value of 611, 612, and 613 areequal to a first U chrominance value U1 and the U chrominance value ofpixels 614, 615, 616, and 617 are equal to a second U chrominance valueU2. Similarly, FIG. 6( c) illustrates the V chrominance value of 611,612, and 613 are equal to a first V chrominance value V1 and the Vchrominance value pixels 614, 615, 616, and 617 are equal to a second Vchrominance value V2. However, actual chrominance values between twocolor regions generally exhibit a gradual change rather than a sharpchange. For example, as illustrated in FIG. 6( d), the U chrominancevalue of pixels 611-617 gradually increases from U chrominance value U1to U chrominance value U2. Similarly, as illustrated in FIG. 6( e) the Vchrominance value of pixels 611-617 gradually decreases from Vchrominance value V1 to V chrominance value V2.

Color transient improvement unit 326 (FIG. 3) detects color transientssuch as illustrated in FIGS. 6( d) and 6(e) that indicate the transitionfrom a first color region to a second color region. The color transientsare then sharpened to be more like the ideal color transientsillustrated in FIGS. 6( b) and 6(c). In general horizontal colortransient along vertical edges are more severe than vertical colortransients. Thus, the embodiment of the present invention describedbelow with respect to FIG. 7 is designed to improve horizontal colortransients. However, one skilled in the art can easily adapt thetechniques of the present invention for vertical color transients.

FIG. 7 illustrates a color transient improvement unit 700, which detectscolor transients utilizing a 3×7 color transient detection window. Otherembodiments of the present invention may use a different sized colortransient detection window. Generally, a wider color transient detectionwindow (i.e. larger in the horizontal direction) will provide betterdetection for wider color transient areas. However, a wider colortransient detection window may produce erroneous results when multiplecolor transients are present within the color transient detectionwindow. Conversely, a thinner color transient detection window may causemischaracterization of wider color transient areas. For clarity, theexamples presented herein use a color transient detection window ofwidth 7, which is the default value of one embodiment of the presentinvention. One skilled in the art can easily adapt the teachingspresented herein to color transient detection windows of other sizes. Ingeneral using color transient detection windows having widths between 5and 15, inclusive, provide good results. For horizontal transients,using line averaging (as described below) on taller color transientdetection windows (i.e. having more lines vertically) provides smootherresults by avoiding jagged edges between color regions. However, if thecolor transient detection window is too tall, some color transientsmight go undetected. Moreover, line averaging over too many lines mightdistort diagonal transients. Furthermore, to support tall windows moreresources (i.e. line buffers) are required. In one embodiment of thepresent invention, the height of the color transient detection windowcan range from 1 to 5 with a default value of 3.

Color transient improvement unit 700 is coupled to buffer 310, which isillustrated using previous line pointer PLP, current line pointer CLPand next line pointer NLP. Color transient improvement unit 700generates improved U chrominance value IUC and improved V chrominancevalue IVC for a current pixel P4 using the chrominance values of pixelsP0-P20. For consistency, pixels P0-P8 are in the same locations as inFIG. 4. Specifically, current pixel P4, pixel P3 and pixel P5 are in thecurrent line (i.e. in the line buffer pointed to by current line bufferCLP), with pixel P3 to the left of current pixel P4 and pixel P5 to theright of current pixel P4. Pixels P0, P1, and P2 are in the previousline (i.e. in the line buffer pointed to by previous line buffer PLP)directly above pixels P3, P4, and P5, respectively. Conversely, pixelsP6, P7, and P8 are in the next line (i.e. in the line buffer pointed toby the next line buffer NLP), directly below pixels P3, P4, and P5,respectively. Furthermore, pixels P9 and P10 are in the previous linewith pixel P10 to the left of and adjacent to pixel P0 and pixel P9 leftof and adjacent to pixel P10. Pixels P11 and P12 are in the previousline with pixel P11 to the right and adjacent to pixel P2 and pixel P12to the right of and adjacent to pixel P11. Pixels P13 to P16 are in thecurrent line directly below pixels P9 to P12, respectively. Pixels P17to P20 are in the next line directly below pixels P13 to P16,respectively. For clarity the U chrominance value and V chrominancevalue of a pixel PX are referenced as U chrominance value UCX and Vchrominance value VCX, respectively. Thus, the U chrominance value and Vchrominance value of pixel P5 is U chrominance value UC5 and Vchrominance value VC5.

Line averaging unit 710 calculates average chrominance values for eachpixel position within the color transient detection window by averagingthe chrominance values of the pixels on each line at the same pixelposition. Specifically, line averaging unit 710 calculates seven averageU chrominance values AUC1 to AUC7 and seven average V chrominance valuesAVC1 to AVC7. Average U chrominance value AUC1 is equal to the averageof U chrominance values UC9, UC13, and UC17, i.e. the U chrominancevalues of pixels P9, which is in the first pixel position in the colortransient detection window on the previous line; P13, which is in thefirst pixel position in the color transient detection window on the nextline; and pixel P17, which is in the first pixel position in the colortransient detection window on the next line. Average U chrominance valueAUC2 is equal to the average of U chrominance values UC10, UC14, andUC18. Average U chrominance value AUC3 is equal to the average of Uchrominance values UC0, UC3, and UC6. Average U chrominance value AUC4is equal to the average of U chrominance values UC1, UC4, and UC7.Average U chrominance value AUC5 is equal to the average of Uchrominance values UC2, UC5, and UC8. Average U chrominance value AUC6is equal to the average of U chrominance values UC11, UC15, and UC19.Average U chrominance value AUC7 is equal to the average of Uchrominance values UC12, UC16, and UC20.

Similarly, Average U chrominance value AVC1 is equal to the average of Vchrominance values VC9, VC13, and VC17. Average V chrominance value AVC2is equal to the average of V chrominance values VC10, VC14, and VC18.Average V chrominance value AVC3 is equal to the average of Vchrominance values VC0, VC3, and VC6. Average V chrominance value AVC4is equal to the average of V chrominance values VC1, VC4, and VC7.Average V chrominance value AVC5 is equal to the average of Vchrominance values VC2, VC5, and VC8. Average V chrominance value AVC6is equal to the average of V chrominance values VC11, VC15, and VC19.Average V chrominance value AVC7 is equal to the average of Vchrominance values VC12, VC16, and VC20.

Transient characterization unit 720 uses the average U chrominancevalues and average V chrominance values to assign transientcharacterization values that correspond to the likelihood of a colortransition occurring in the color transient detection window.Specifically, in one embodiment of the present invention, transientcharacterization unit 720 generates an average U chrominance incrementsum AUCIS, an average U chrominance decrement sum AUCDS, an average Vchrominance increment sum AVCIS, and an average V chrominance decrementsum AVCDS. For every color transient detection window, average Uchrominance increment sum AUCIS, an average U chrominance decrement sumAUCDS, an average V chrominance increment sum AVCIS, and an average Vchrominance decrement sum AVCDS are all first set initially to zero.Average U chrominance increment sum AUCIS is incremented by one for eachaverage U chrominance value AUCX that is greater than or equal toaverage U chrominance value AUC(X−1), where X is in the ranges from 2 to7. Thus, average U chrominance increment sum AUCIS provides a measurethat corresponds to the degree that the average U chrominance valuescalculated by line averaging unit 710 is monotonically increasing (fromleft to right). Average U chrominance decrement sum AUCDS is incrementedby one for each average U chrominance value AUCX that is less than orequal to average U chrominance value AUC(X−1), where X is in the rangesfrom 2 to 7. Thus, average U chrominance decrement sum AUCDS provides ameasure that corresponds to the degree that the average U chrominancevalues calculated by line averaging unit 710 are monotonicallydecreasing (from left to right).

Similarly, Average V chrominance increment sum AVCIS is incremented byone for each average V chrominance value AVCX that is greater than orequal to average V chrominance value AVC(X−1), where X is in the rangesfrom 2 to 7. Thus, average V chrominance increment sum AVCIS provides ameasure that corresponds to the degree that the average V chrominancevalues calculated by line averaging unit 710 are monotonicallyincreasing. Average V chrominance decrement sum AVCDS is incremented byone for each average V chrominance value AVCX that is less than or equalto average V chrominance value AVC(X−1), where X is in the ranges from 2to 7. Thus, average V chrominance decrement sum AVCDS provides a measurethat corresponds to the degree that the average V chrominance valuescalculated by line averaging unit 710 are monotonically decreasing.

As illustrated in FIGS. 6( d) and 6(e) when both the U chrominancevalues of a line of pixels and the V chrominance values of a line ofpixels are monotonically increasing or monotonically decreasing, thelikelihood that the pixels are near a transition between color regionsis high. However, due to line averaging and the possible existence ofchrominance noise, color transitions may occur even if the average Uchrominance values or average V chrominance values calculated by lineaveraging unit 710 are not strictly monotonically increasing ordecreasing. Thus, transient threshold unit 730 uses a programmablechrominance color improvement threshold CCIT to determine whether thechrominance values of current pixel P4 should be modified. Specifically,transient threshold unit 730 compares average U chrominance incrementsum AUCIS, average U chrominance decrement sum AUCDS, average Vchrominance increment sum AVCIS, and average V chrominance decrement sumAVCDS with chrominance color improvement threshold CCIT. If average Uchrominance increment sum AUCIS is greater than or equal to chrominancecolor improvement threshold CCIT or average U chrominance decrement sumAUCDS is greater than or equal to chrominance color improvementthreshold CCIT and average V chrominance increment sum AVCIS is greaterthan or equal to chrominance color improvement threshold CCIT or averageV chrominance decrement sum AVCDS is greater than or equal tochrominance color improvement threshold CCIT then the chrominance valuesof the current pixel should be modified. In symbolic form transientthreshold unit 730 performs the following: If ((AUCIS >=CCIT) OR(AUCDS >=CCIT)) AND ((AVCIS >=CCIT) OR (AVCDS >=CCIT)) then modifycurrent pixel chrominance values.

Transient correction unit 750 generates improved U chrominance value IUCand improved V chrominance value IVC based on information provided byleft/right side averaging unit 740 and transient threshold unit 730. Asexplained above, transient threshold unit 730 determines whether thechrominance values of current pixel P4 should be modified. When thechrominance values of the current pixel should not be modified asdetermined by transient threshold unit 730, transient correction unit750 sets improved U chrominance value IUC to be equal to the Uchrominance value UC4, which is the U chrominance value of current pixelP4. Similarly, when the chrominance values of the current pixel shouldnot be modified as determined by transient threshold unit 730, transientcorrection unit 750 sets improved V chrominance value IVC to be equal tothe V chrominance value VC4, which is the V chrominance value of currentpixel P4.

When transient threshold unit 730 determines that the chrominance valuesof the current pixel should be modified transient correction unit 750determines whether the current pixel is closer to the pixels to the leftof the current pixel in the color transient detection window or closerto the pixels to the right of the current pixel in the color transientdetection window. In the embodiment of the invention described belowrather than using the chrominance value of the current pixel, average Uchrominance value AUC4 and average V chrominance value AVC4 as a proxyfor the chrominance values of the current pixel to determine whether touse the pixels to the left or to the right of the current pixel. Howeverother embodiments of the present invention can use other proxychrominance values or use the actual chrominance values of the currentpixel (i.e. U chrominance value UC4 and V chrominance value VC4).

Left/right side averaging unit 740 calculates the average U chrominanceand average V chrominance of the pixels to the left of the current pixeland of the pixels to the right of the current pixel. Specifically forthe embodiment of FIG. 7, an average left side U chrominance value ALSUCis equal to the average of U chrominance values UC9, UC10, UC0, UC13,UC14, UC3, UC17, UC18, and UC6. An average left side V chrominance valueALSVC is equal to the average of V chrominance values VC9, VC10, VC0,VC13, VC14, VC3, VC17, VC18, and VC6. An average right side Uchrominance value ARSUC is equal to the average of U chrominance valuesUC2, UC11, UC12, UC5, UC15, UC16, UC8, UC19, and UC20. An average rightside V chrominance value ARSVC is equal to the average of V chrominancevalues VC2, VC11, VC12, VC5, VC15, VC16, VC8, VC19, and VC20.

If the average U chrominance value AUC4 is closer to average left side Uchrominance value ALSUC than to average right side U chrominance valueARSUC and if the average V chrominance value AVC4 is closer to averageleft side V chrominance value ALSVC than to average right side Vchrominance value ARSVC then transient correction unit 750 sets improvedU chrominance value IUC and improved V chrominance value IVC equal toaverage left side U chrominance value ALSUC and average left side Vchrominance value ALSVC, respectively. Conversely, if the average Uchrominance value AUC4 is closer to average right side U chrominancevalue ARSUC than to average left side U chrominance value ALSUC and ifthe average V chrominance value AVC4 is closer to average right side Vchrominance value ARSVC than to average left side V chrominance valueALSVC then transient correction unit 750 sets improved U chrominancevalue IUC and improved V chrominance value IVC equal to average rightside U chrominance value ARSUC and average right side V chrominancevalue ARSVC, respectively. Appendix I presents a pseudo-codeimplementation of one embodiment of transient threshold unit 730 andtransient correction unit 750. One skilled in the art can easily convertthe pseudo-code of Appendix I into VHDL or Verilog to create a hardwareimplementation.

Returning to FIG. 3, improved U chrominance value IUC and improved Vchrominance value IVC are further enhanced by color saturation controlunit 328. Specifically, color saturation control unit 328 enhances thesaturation of improved U chrominance value IUC and improved Vchrominance value IVC to generate saturation enhanced U chrominancevalue SEUC and saturation enhanced V chrominance value SEVC. Colorsaturation control unit 328 enhances the color of the input video signalby increasing the saturation by a base saturation enhancement factorBSEF. The ratio of improved U chrominance value IUC to improved Vchrominance value IVC (i.e. IUC/IVC) defines the color for the currentpixel. The norm of (IUC, IVC) defines the saturation. When improved Vchrominance value IVC is zero, the color is determined by improved Uchrominance value IUC. Specifically, the sign (positive or negative) ofimproved U chrominance value IUC defines the color and the absolutevalue of improved U chrominance value IUC defines the saturation. Whenboth improved U chrominance value IUC and improved V chrominance valueIVC are zero, no color is defined, and the pixel is a grey scale pixeldefined by the luminance information.

Increased saturation can be achieved by increasing the norm of (IUC,IVC), which is equal to the square root of the sum of the squares ofimproved U chrominance value IUC and improved V chrominance value IVC(i.e. sqrt(IUC²+IVC²)). However, the ratio of saturation enhanced Uchrominance value SEUC to saturation enhanced V chrominance value SEVC(i.e. SEUC/SEVC), should be equal to the ratio of improved U chrominancevalue IUC to improved V chrominance value IVC (i.e. IUC/IVC) to avoidintroducing color distortions. For conciseness and clarity, the termsaturated enhanced chrominance ratio SEUC/SEVC is used for the ratio ofsaturation enhanced U chrominance value SEUC to saturation enhanced Vchrominance value SEVC. Similarly, the term improved chrominance ratioIUC/IVC is used to for the ratio of improved U chrominance value to IUCto improved V chrominance value IVC.

Thus, in general, the saturation can be enhanced by multiplying bothimproved U chrominance value IUC and improved V chrominance value IVC bybase saturation enhancement factor BSEF. However, the various Uchrominance values and V chrominance values IVC are typically bounded ina chrominance range C_RANGE between a minimum chrominance value C_MINand a maximum chrominance value C_MAX, inclusive. For example, if 8 bitswere used for chrominance values, minimum chrominance value C_MIN wouldequal −128 and maximum chrominance value C_MAX would equal to 127. If achrominance value is computed to be outside of chrominance rangeC_RANGE, the chrominance value would be truncated to equal minimumchrominance value C_MIN (for negative chrominance values) or to equalmaximum chrominance value C_MAX (for positive chrominance values). Ifenhancement by base saturation enhancement factor BSEF would causeeither chrominance value to go beyond the chrominance range C_RANGE,color distortion would occur. For example, if base saturationenhancement factor BSEF is equal to 1.2, improved U chrominance valueIUC is equal to 120 and improved V chrominance value IVC is equal to 40.Simply multiplying the chrominance values by base saturation enhancementfactor BSEF would result in saturation enhanced U chrominance value SEUCbeing equal to 127 (i.e., 144 truncated to 127) and saturation enhancedV chrominance value SEVC being equal to 48. Thus, saturation enhancedchrominance ratio SEUC/SEVC is equal to 127/48 which is not equal toimproved chrominance ratio IUC/IVC, which is equal to 120/40. To avoidcolor distortion, the present invention uses a scaled saturationenhancement factor SSEF when using a base saturation enhancement factorBSEF that would cause color distortions due to range limitations on thechrominance values.

FIG. 8 shows one embodiment of a color saturation control unit 800. Theembodiment of FIG. 8 includes a scaled saturation enhancement factor(SSEF) calculation unit 810 and a multiplier 820. SSEF calculation unit810 computes scaled saturation enhancement factor SSEF using basesaturation enhancement factor BSEF, improved U chrominance factor IUC,improved V chrominance factor IVC, maximum chrominance value C_MAX, andminimum chrominance value C_MIN. Specifically, scaled saturationenhancement factor should be equal to base saturation enhancement factorBSEF or the largest possible value without causing the chrominancevalues to exceed the range of minimum chrominance value C_MIN andmaximum chrominance value C_MAX. In one embodiment of the presentinvention, SSEF calculation unit 810 calculates a maximum U enhancementfactor MUEF, and a maximum V enhancement factor MVEF. Scaled saturationenhancement factor SSEF is set equal to the smallest value selected frombase saturation enhancement factor BSEF, maximum U enhancement factorMUEF, and maximum V enhancement factor MVEF. Maximum U enhancementfactor MUEF can be calculated by selecting the greater of dividingmaximum chrominance value C_MAX by improved U chrominance value IUC ordividing minimum chrominance value C_MIN by improved U Chrominance valueIUC. Similarly, maximum V enhancement factor MVEF can be calculated byselecting the greater of dividing maximum chrominance value C_MAX byimproved V chrominance value IVC or dividing minimum chrominance valueC_MIN by improved V Chrominance value IVC. Equations EQ (9), EQ (10),and EQ (11) provides the formula for calculating maximum U enhancementfactor MUEF, maximum U enhancement factor MVEF, and scaled saturationenhancement factor SSEF in symbolic form.

MUEF=MAX((C _(—) MAX/IUC),(C _(—) MIN/IUC))  EQ (9)

MVEF=MAX((C _(—) MAX/IVC),(C _(—) MIN/IVC))  EQ (10)

SSEF=MIN(BSEF,MUEF,MVEF)  EQ (11)

When improved U chrominance value IUC is equal to 0, maximum Uenhancement factor MUEF set equal to a pre-defined large number DIV0rather than performing the division operations (which would result in adivide by zero error). Similarly when improved V chrominance value IVCis zero, maximum V enhancement factor MVEF is set equal to pre-definedlarge number DIV0 rather than performing the division operations.Pre-defined large number DIV0 should be large enough so that scaledsaturation enhancement factor SSEF would not be equal to pre-definedlarge number DIV0, i.e. pre-defined large number DIV0 should be greaterthan the largest values expected for base saturation enhancement factorBSEF.

After SSEF calculation unit 810 calculates scaled saturation enhancementfactor SSEF, multiplier 820 calculates saturation enhanced U chrominancevalue SEUC and saturation enhanced V chrominance value SEVC bymultiplying scaled saturation enhancement factor SSEF with improved Uchrominance value IUC and improved V chrominance value IVC,respectively.

In the embodiment of FIG. 8 a floating point division circuit is used inthe calculation of scaled saturation enhancement circuit SSEF. However,floating point division circuits require a large amount of siliconresources to implement and require many clock cycles to execute.Therefore, some embodiments of the present invention implement SSEFcalculation circuit 810 using a lookup table. FIG. 9 illustrates a SSEFcalculation circuit 900 in accordance with one embodiment of the presentinvention. The embodiment of FIG. 9 includes an index calculation andcontrol circuit 910, a lookup table (LUT) 920, and a multiplexer 930.

Index calculation and control circuit 910 generates an index value INDEXfor lookup table 920, a preset saturation enhancement value PSEF, and aselection control signal SCS to control multiplexer 930. Presetsaturation enhancement factor PSEF is provided to a first input port ofmultiplexer 930. Lookup table 920 provides a tabled saturationenhancement factor TSEF, which is provided on a second input port ofmultiplexer 930. Multiplexer 930 drives either tabled saturationenhancement factor TSEF or preset saturation enhancement factor PSEF asscaled saturation enhancement factor SSEF under control of indexcalculation and control circuit 910.

Index calculation and control circuit 910 drives either base saturationenhancement factor BSEF or one (i.e. 1) as preset saturation enhancementfactor PSEF. Specifically, if improved U chrominance value IUC orimproved V chrominance value IVC is equal to minimum chrominance valueC_MIN or maximum chrominance value C_MAX, then the saturation of thecurrent pixel cannot be further enhanced. Therefore, scaled saturationenhancement factor should equal one. Accordingly, index calculation andcontrol circuit 910 sets preset saturation enhancement factor PSEF equalto one and drives saturation control signal SCS so that multiplexer 930uses preset saturation enhancement factor PSEF as scaled saturationenhancement factor SSEF. Otherwise, index calculation and controlcircuit 910 sets preset saturation enhancement factor PSEF equal to basesaturation enhancement factor BSEF.

Index calculation and control circuit 910 calculates index INDEX as thegreater of the absolute value of improved U chrominance value IUC andthe absolute value of improved V chrominance value IVC (i.e.INDEX=MAX(abs(IUC), abs(IVC)). However, if index INDEX is greater thanmaximum chrominance value C_MAX (i.e. 127 in the case of 8-bitchrominance values), which would occur if improved U chrominance valueIUC or improved V chrominance value IVC is equal to minimum chrominancevalue C_MIN (i.e. −128 in the case of 8-bit chrominance values), thenindex INDEX can be set equal to any valid range of lookup table 920because multiplexer 930 is configured (as described above) to use presetsaturation enhancement factor PSEF. When index INDEX is less than oneplus the integer value of maximum chrominance value C_MAX divided bybase saturation enhancement factor BSEF (i.e. 1+INT(C_MAX/BSEF)), indexcalculation and control circuit 910 drives saturation control signal SCSso that multiplexer 930 uses preset saturation enhancement factor PSEFas scaled saturation enhancement factor SSEF. To avoid performingfloating point division, the comparison can be rearranged as when indexINDEX multiplied with BSEF is less than or equal to the maximumchrominance value C_MAX (i.e. INDEX*BSEF<=C_MAX) then index calculationand control circuit 910 drives saturation control signal SCS so thatmultiplexer 930 uses preset saturation enhancement factor PSEF as scaledsaturation enhancement factor SSEF. As explained above in thesesituations preset saturation enhancement factor PSEF is equal to basesaturation enhancement factor BSEF. When index INDEX multiplied withBSEF is greater than the maximum chrominance value C_MAX and INDEX isless than the maximum chrominance value C_MAX, index calculation andcontrol circuit 910 drives saturation control signal SCS so thatmultiplexer 930 uses tabled saturation enhancement factor TSEF as scaledsaturation enhancement factor SSEF. Because preset saturationenhancement factor PSEF is equal to base saturation enhancement factorBSEF or 1, some embodiments of the present invention may use a threeinput multiplexing circuit having a first input port coupled to receivethe base saturation enhancement factor, a second input port coupled toreceive the tabled saturation enhancement factor, a third input portcoupled to receive a value of one. Appendix II provides a pseudo-codeimplementation of SSEF calculation circuit 900 that uses a lookup table920 configured as described below. One skilled in the art can easilytranslate the pseudo-code of Appendix II into VHDL or Verilog togenerate a hardware implementation.

Lookup table 920 includes a plurality of tabled saturation enhancementfactors TSEFs that are selected by an index INDEX. The tabled saturationenhancement factors TSEFs of lookup table 920 depends on the precision,i.e. number of bits, of multiplier 820 (FIG. 8). For example if improvedU chrominance value is 123, improved V chrominance value is 40, maximumchrominance value is 127, an unlimited precision multiplier would allowscaled saturation enhancement factor SSEF to be equal to 1.0325203252 .. . (i.e. 127/123). However if multiplier 820 is a 5-bit multiplier, ascaled saturation enhancement factor SSEF equal to 1.0325203252, ifrounded to 1.0625, would cause saturation enhanced U chrominance valueSEUC to be equal to 130.7 (1.0625*123), which would be truncated to 130,which is out of the chrominance range C_RANGE. For a 5-bit multiplier,scaled saturation enhancement factor SSEF should be equal to 1.03125,which leads to scaled saturation enhancement factor SEUC being equal to126.8, and 126 after truncation which is within C_RANGE. Equation EQ(12) provides a formula for the generation of tabled saturationenhancement factors TSEFs for lookup table 920 having index values INDEXand maximum chrominance value C_MAX using a multiplier having PB bits ofprecision in accordance with one embodiment of the present invention.

TSEF=INT((C_MAX/INDEX)*(2̂PB))/(2̂PB)  EQ (12)

TO minimize the size of lookup table 920, some embodiments of thepresent invention limits the size of base saturation enhancement factorBSEF to a maximum saturation enhancement factor MSEF. As explainedabove, When index INDEX multiplied with BSEF is greater than the maximumchrominance value C_MAX and INDEX is less than the maximum chrominancevalue C_MAX, index calculation and control circuit 910 drives saturationcontrol signal SCS so that multiplexer 930 uses tabled saturationenhancement factor TSEF as scaled saturation enhancement factor SSEF.Thus, if base saturation enhancement factor BSEF is limited to maximumsaturation enhancement factor MSEF, lookup table 920 only needs tocontain tabled saturation enhancement factors TSEFs for index valuesfrom one plus the integer value of maximum chrominance value C_MAXdivided by maximum saturation enhancement factor MSEF (i.e.1+INT(C_MAX/MSEF)) to maximum chrominance value C_MAX. For example, ifC_MAX is equal to 127, maximum saturation enhancement factor MSEF isequal to 2, lookup table 920 only needs to contain values for indicesfrom 64 to 127 and therefore only has to contain 64 tabled saturationenhancement factors TSEFs.

In the various embodiments of the present invention, novel structureshave been described for enhancing images of a video stream.Specifically, contour enhancement and luminance contrast stretching areused to improve the luminance values of the images. In addition colortransient improvement and color saturation control are performed toenhance the chrominance values of the images. The various embodiments ofthe structures and methods of this invention that are described aboveare illustrative only of the principles of this invention and are notintended to limit the scope of the invention to the particularembodiments described. For example, in view of this disclosure thoseskilled in the art can define other contour enhancement units, luminancecontrast stretching units, color transient improvement units, colorsaturation control units, contour proxies, contour directions, slopes,slope directions, contour detection unit, contour enhanced luminancecalculation unit, contour threshold comparison unit, color transientdetection windows, transient characterization values, color transients,U chrominance proxies, V chrominance proxies, transient characterizationunit, transient threshold units, transient correction units, saturationenhancement factors, saturation enhanced chrominance values, maximumsaturation enhancement factors, table indices, lookup tables, tableentries, scaled saturation enhancement factor calculation units,multipliers, index calculation units, multiplexing circuits, indexcalculation and control circuit and so forth, and use these alternativefeatures to create a method, circuit, or system according to theprinciples of this invention. Thus, the invention is limited only by thefollowing claims.

APPENDIX I AUCIS = average U chrominance increment sum AUCDS = average Uchrominance decrement sum AVCIS = average V chrominance increment sumAVCDS = average V chrominance decrement sum AUC4 = average U chrominancevalue of the current pixel column  in the transient detection windowAVC4 = average V chrominance value of the current pixel column  in thetransient detection window UC4 = U chrominance value of the currentpixel VC4 = V chrominance value of the current pixel ARSUC = averageright side U chrominance ALSUC = average left side U chrominance ARSVC =average right side V chrominance ALSVC = average left side V chrominanceCCIT = chrominance color improvement threshold IUC = improved Uchrominance IVC = improved V chrominance IF ((AUCIS >= CCIT) OR(AUCDS >= CCIT)) AND ((AVCIS >= CCIT) OR (AVCDS >= CCIT)]) THEN  {  IFABS(AUC4-ALSUC) < ABS(AUC4-ARSUC) AND ABS(AVC4-ALSVC) < ABS(AVC4-ARSVC)THEN { IUC = ALSUC IVC = ALSVC }  ELSE IF ABS(AUC4-ALSUC) >ABS(AUC4-ARSUC) AND  ABS(AVC4-ALSVC) > ABS(AVC4-ARSVC) THEN { IUC =ARSUC IVC = ARSVC }  ELSE  {  IUC=UC4  IVC=VC4  } ELSE  {  IUC=UC4 IVC=VC4  }

APPENDIX II IUC = improved U chrominance IVC = improved V chrominanceC_MAX = maximum chrominance value C_MIN = minimum chrominance value BSEF=  base saturation enhancement factor INDEX = index to a lookup tableTSEF = tabled saturation enhancement factor (from a lookup table indexedby INDEX) INDEX = max(abs(IUC), abs(IVC)) IF (INDEX >= C_MAX) then {INDEX=C_MAX SSEF = 1 } ELSE IF (INDEX*BSEF ≦ C_MAX) then { SSEF=BSEF }ELSE IF (INDEX*BSEF > C_MAX) and (INDEX < C_MAX)) then { SSEF=TSEF }

1. A method for enhancing an image having a plurality of pixels, themethod comprising: determining a dominant contour direction for acurrent pixel with a contour enhancement unit; enhancing a contour ofthe current pixel by a contour enhancement factor along the dominantcontour direction with a contour enhancement unit; calculating asecondary contour direction for the current pixel with a contourenhancement unit; and wherein the enhancing a contour of the currentpixel by a contour enhancement factor along the dominant contourdirection is performed only when the magnitude of the dominant contourdirection minus the magnitude of the secondary contour direction isgreater than a contour enhancement threshold.
 2. The method of claim 1,wherein the dominant contour direction is determined using a dominantslope direction of the current pixel.
 3. The method of claim 1, whereinthe determining a dominant contour direction for a current pixelcomprises: calculating a plurality of slopes for a plurality of slopedirections for the current pixel; selecting a dominant slope directionfrom the plurality of slope directions as the dominant direction of thecontour of the current pixel, wherein the dominant slope direction has alargest absolute slope value from among the slop directions.
 4. Themethod of claim 3, wherein the calculating a plurality of slopes for thecurrent pixel uses only luminance data.
 5. The method of claim 3,wherein the calculating a plurality of slopes for the current pixelcomprises: calculating a vertical slope for the current pixel;calculating a horizontal slope for the current pixel; and calculating adiagonal slope for the current pixel.
 6. The method of claim 3, whereinthe calculating a plurality of slopes for the current pixel comprises:calculating a vertical slope for the current pixel; calculating ahorizontal slope for the current pixel; calculating a first diagonalslope for the current pixel; and calculating a second diagonal slope forthe current pixel.
 7. The method of claim 1 wherein the magnitude of thedominant contour direction is equal to an absolute value of a dominantslope of the current pixel.
 8. The method of claim 1 wherein themagnitude of the secondary contour direction is equal to an absolutevalue of a secondary slope of the current pixel.
 9. The method of claim1, wherein the enhancing a contour of the current pixel by a contourenhancement factor along the dominant contour direction furthercomprises replacing the luminance value of the current pixel with anenhanced luminance value such that an enhanced slope of the dominantcontour direction calculated using the enhanced luminance value is equalto a contour enhancement factor multiplied by a slope of the dominantcontour direction.
 10. The method of claim 9, wherein the enhanced slopeof the dominant contour direction is calculated using the enhancedluminance value of the current pixel and the slope of the dominantcontour direction is calculated using the luminance value of the currentpixel.
 11. A method for enhancing an image having a plurality of pixels,the method comprising: determining a dominant contour direction for acurrent pixel with a contour enhancement unit; enhancing a contour ofthe current pixel by a contour enhancement factor along the dominantcontour direction with a contour enhancement unit; wherein thedetermining a dominant contour direction for a current pixel comprises:calculating a plurality of slopes for a plurality of slope directionsfor the current pixel; selecting a dominant slope direction from theplurality of slope directions as the dominant direction of the contourof the current pixel, wherein the dominant slope direction has a largestabsolute slope value from among the slop directions; wherein thecalculating a plurality of slopes for the current pixel comprises:calculating a vertical slope for the current pixel; calculating ahorizontal slope for the current pixel; and calculating a diagonal slopefor the current pixel; and wherein the diagonal slope for the currentpixel is equal to the luminance of the current pixel minus an averageluminance of a first pixel above the current pixel, a second pixel belowthe current pixel, a third pixel to the left of the current pixel, and afourth pixel to the right of the current pixel.
 12. A method forenhancing an image having a plurality of pixels, the method comprising:determining a dominant contour direction for a current pixel with acontour enhancement unit; enhancing a contour of the current pixel by acontour enhancement factor along the dominant contour direction with acontour enhancement unit; wherein the determining a dominant contourdirection for a current pixel comprises: calculating a plurality ofslopes for a plurality of slope directions for the current pixel;selecting a dominant slope direction from the plurality of slopedirections as the dominant direction of the contour of the currentpixel, wherein the dominant slope direction has a largest absolute slopevalue from among the slop directions; wherein the calculating aplurality of slopes for the current pixel comprises: calculating avertical slope for the current pixel; calculating a horizontal slope forthe current pixel; and calculating a diagonal slope for the currentpixel; and wherein the vertical slope is equal to a first averageluminance of the current pixel, a first pixel above of the current pixeland a second pixel below the current pixel minus a second averageluminance of a third pixel above and to the left of the current pixel, afourth pixel to the left of the current pixel, a fifth pixel below andto the left of the current pixel, a sixth pixel above and to the rightof the current pixel, a seventh pixel to the right of the current pixel,and an eighth pixel below and to the right of the current pixel.
 13. Amethod for enhancing an image having a plurality of pixels, the methodcomprising: determining a dominant contour direction for a current pixelwith a contour enhancement unit; enhancing a contour of the currentpixel by a contour enhancement factor along the dominant contourdirection with a contour enhancement unit; wherein the determining adominant contour direction for a current pixel comprises: calculating aplurality of slopes for a plurality of slope directions for the currentpixel; selecting a dominant slope direction from the plurality of slopedirections as the dominant direction of the contour of the currentpixel, wherein the dominant slope direction has a largest absolute slopevalue from among the slop directions; wherein the calculating aplurality of slopes for the current pixel comprises: calculating avertical slope for the current pixel; calculating a horizontal slope forthe current pixel; and calculating a diagonal slope for the currentpixel; and wherein the horizontal slope is equal to a first averageluminance of the current pixel, a first pixel to the left of the currentpixel and a second pixel to the right of the current pixel minus asecond average luminance of a third pixel above and to the left of thecurrent pixel, a fourth pixel above the current pixel, a fifth pixelabove and to the right of the current pixel, a sixth pixel below and tothe left of the current pixel, a seventh pixel below the current pixel,and an eighth pixel below and to the right of the current pixel.
 14. Acontour enhancement unit for enhancing the contours of an image having aplurality of pixels, the contour enhancement unit comprising: a contourdetection unit configured to determine the dominant contour direction ofa current pixel; wherein the contour detection unit is configured tocalculate a magnitude of the dominant contour direction and a magnitudeof a secondary contour direction; a contour enhanced luminancecalculation unit coupled to the contour detection unit and configured togenerate an enhanced luminance value for the current pixel, wherein theenhanced luminance value enhances the contour of the current pixel inthe dominant contour direction; a contour threshold comparison unitcoupled to the contour detection unit and the contour enhanced luminancecalculation unit, wherein the contour threshold comparison unit controlsthe contour enhanced luminance calculation unit based on the magnitudeof the dominant contour direction and the magnitude of the secondarycontour direction, and wherein the contour threshold comparison unitcauses the contour enhanced luminance calculation unit to use theluminance value of the current pixel as the contour enhanced luminancevalue when the magnitude of the dominant contour direction minus themagnitude of the secondary contour direction is less than or equal to acontour enhancement threshold.
 15. The contour enhancement unit of claim14, wherein the contour detection unit is configured calculate aplurality of slopes for a plurality of slope directions and to select adominant slope direction as the dominant contour direction, wherein thedominant slope direction has a largest magnitude from among the slopedirections.
 16. The contour enhancement unit of claim 14, wherein anenhanced slope of the dominant contour direction calculated using theenhanced luminance value is equal to a contour enhancement factormultiplied by a slope of the dominant contour direction.
 17. The contourenhancement unit of claim 16, wherein the enhanced slope of the dominantcontour direction is calculated using the enhanced luminance value andthe slope of the dominant contour direction is calculated using theluminance value of the current pixel.